<?php

// Include
include_once('include/header.php');
include_once('plugin/PlanesDBPlugin.php');


// Breadcrumb
$breadcrumb = AppConfigPlugin::getBreadcrumb(basename($_SERVER['PHP_SELF']));
$smarty->assign('breadcrumb', $breadcrumb);


// Procesar el formulario
if (isset($_POST[sendform])) {
	if (isset($_POST[action]) && ($_POST[action] == "save")) {
		PlanesDBPlugin::add($_POST[nombre], $_POST[caracgral], $_POST[caracunidad], $_POST[proyinversion]);
		CommonPlugin::setMessage("El nuevo plan se ha guardado correctamente");
	}
	header( 'Location: planes.php' );
	exit;	
}


// Smarty call
$smarty->display('addplan.tpl');

?>